// pages/accidentReport/reportOrderSelect/index.js
import requestUtil from '../../../baseRequest.js'
import requestUrls from '../../../requestUrl.js'
import { $Message } from '../../../components/base/index'

Page({
  /**
   * 页面的初始数据
   */
  data: {
    transportConfirmList: [],
    labelSlot:true,

  },
  handleSelectItem(e) {
    let targetOrderId = e.currentTarget.id
    wx.navigateTo({
      url: `/pages/arbitration/create/index?transportConfirmFormId=${targetOrderId}`,
    })
  },

  /**获取我的确认单列表 */
  getTransportConfirmList(status) {
    if (!this.data.openid) {
      this.setData({
        spinShow: true
      })
      setTimeout(() => {
        let openid = getApp().getUserOpenid()
        this.setData({
          openid
        })
        this.getTransportConfirmList(status)
      }, 1000);
    } else {
      if (this.data.spinShow) {
        this.setData({
          spinShow: false
        })
      }
      let param = {
        "openid": this.data.openid,
        "status": status
      }
      requestUtil.postRequest(requestUrls.transportConfirm.list, param, (res) => {
        this.setData({
          transportConfirmList: res.list
        })
      }, () => { })
    }
  },


  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    this.getTransportConfirmList(2)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
